<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <%@ include file="/WEB-INF/views/mod2016/include/head.jsp" %>
    <title>报表配置</title>
</head>
<body class="bg-gray">
<!-- top start  -->
<jsp:include page="/pub/include/top"/>

<div class=" cbox clearfix mgt-10">

    <jsp:include page="/pub/include/nav?navCode=configIn"/>
    <div class="con-wr mgb-10  fr">
        <!-- 面包屑 start -->
        <jsp:include page="/pub/include/bread?navCode=configIn"/>
        <!-- 面包屑 end -->
        <div class="recommend-s1  bg-white pdb-10">
            <!-- 三级菜单 start-->
            <jsp:include page="/pub/include/threeNav?navCode=configIn"/>
            <!-- 三级菜单 end-->

            <!-- 此处为页面代码 start-->
            <div class=" mgt-10 pdt-10 pdb-30">
                <form:form id="inputForm" modelAttribute="reportConfigIn" action="${ctx}/report/configIn/save" method="post">
                    <form:hidden path="inConditionId"/>
                    <input name="reportId" type="hidden" value="${reportId }"/>

                    <div class="searchbar searchbar-n  ">
                        <div class="col-w2 clearfix">
                            <div class="col-w2-left fl">
                                <span class="font-red w-input262">*</span>参数名称：
                            </div>
                            <div class="col-w2-right fl">
                                <form:input path="itemName" htmlEscape="false" class="w-input262 required"/>
                            </div>
                        </div>
                        <div class="col-w2 clearfix">
                            <div class="col-w2-left fl">
                                <span class="font-red w-input262">*</span>参数编码：
                            </div>
                            <div class="col-w2-right fl">
                                <form:input path="itemCode" htmlEscape="false" class="w-input262 required"/>
                            </div>
                        </div>
                        <div class="col-w2 clearfix">
                            <div class="col-w2-left fl"><span class="font-red w-input262">*</span>参数类型：</div>
                            <div class="col-w2-right fl">
                                <form:select path="itemType" class="w-input280 required" onchange="changeShow(this.value)">
                                    <form:option value="">请选择</form:option>
                                    <form:options items="${fns:getDictList('REPORT_CONFIGIN_ITEMTYPE')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                </form:select>
                            </div>
                        </div>
                        <%--
                        <div class="col-w2 clearfix">
                            <div class="col-w2-left fl"><span class="font-red">*</span>查询sql：</div>
                            <div class="col-w2-right fl">
                                <form:textarea path="sqlRef" class="input-n3 w-input550 h60"></form:textarea>
                            </div>
                        </div>
                        --%>

                        <div class="col-w2 clearfix">
                            <div class="col-w2-left fl"><span class="font-red">*</span>参数限制类型：</div>
                            <div class="col-w2-right fl"  id="check">
                                <div id="checkType1" style="display:none">
                                    <input name="checkType" readonly="readonly" class="w-input262" placeholder="不需要填写任何值"/>
                                </div>
                                <div id="checkType2" style="display:none">
                                    <textarea name="checkType" htmlEscape="false" class="input-n3 w-input262 h60" placeholder="0,xxxxx;1,yyyyy 形式"
                                    ><c:if test="${reportConfigIn.itemType eq '2' }">${reportConfigIn.checkType}</c:if></textarea>
                                </div>
                                <div id="checkType3" style="display:none">
                                    <form:select path="checkType" class="w-input262">
                                        <form:option value="">请选择</form:option>
                                        <form:options items="${fns:getDictList('REPORT_CONFIGIN_ITEMTYPE')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                    </form:select>
                                </div>
                                <div id="checkType4" style="display:none">
                                    <textarea name="checkType" htmlEscape="false" class="input-n3 w-input262 h60" placeholder="select aaa as label,bbb as value from c 形式"
                                    ><c:if test="${reportConfigIn.itemType eq '4' }">${reportConfigIn.checkType }</c:if></textarea>
                                    <span class="help-inline"></span>
                                </div>
                                <div id="checkType5" style="display:none">
                                    <form:select path="checkType" class="w-input262">
                                        <form:option value="yyyy-MM-dd">yyyy-MM-dd</form:option>
                                        <form:option value="yyyy-MM-dd HH:mm:ss">yyyy-MM-dd HH:mm:ss</form:option>
                                    </form:select>
                                </div>
                            </div>
                        </div>
                        <div class="col-w2 clearfix">
                            <div class="col-w2-left fl"><span class="font-red">*</span>参数作用类型：</div>
                            <div class="col-w2-right fl">
                                <form:select path="paramType"  class="w-input280 required">
                                    <form:option value="">请选择</form:option>
                                    <form:options items="${fns:getDictList('REPORT_CONFIGIN_PARAMTYPE')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                </form:select>
                            </div>
                        </div>
                        <div class="col-w2 clearfix" >
                            <div class="col-w2-left fl"><span class="font-red">*</span>是否展示：</div>
                            <div class="col-w2-right fl">
                                <input class="inp-radio required" type="radio" name="isShow" value="1" <c:if test="${reportConfigIn.isShow=='1'}">checked="checked"</c:if>><span class="b-radio mgl-10"><b></b>展示</span>
                                <input class="inp-radio" type="radio" name="isShow" value="0" <c:if test="${reportConfigIn.isShow=='0'}">checked="checked"</c:if>><span class="b-radio mgl-20"><b></b>隐藏</span>
                            </div>
                        </div>
                        <div class="col-w2 clearfix">
                            <div class="col-w2-left fl">参数初始值：</div>
                            <div class="col-w2-right fl">
                                <form:input path="initialValue" htmlEscape="false" class="w-input262" placeholder="时间区间示例：标记;开始字段;结束字段"/>
                                <span>常用标记：当年:YY|当季:QQ|当月:MM|当周:WW|当日:DD</span>
                            </div>
                        </div>
                        <%--
                        <div class="col-w2 clearfix" style="display: none;">
                            <div class="col-w2-left fl">
                                <span class="font-red w-input262">*</span>事件内容：
                            </div>
                            <div class="col-w2-right fl">
                            </div>
                        </div>

                        <div class="col-w2 clearfix">
                            <div class="col-w2-left fl">备注：</div>
                            <div class="col-w2-right fl">
                                <form:textarea path="remark" htmlEscape="false"  class="input-n3 w-input262 h60"></form:textarea>
                            </div>
                        </div>
                         --%>
                        <div class="ac">
                            <shiro:hasPermission name="report:configIn:edit">
                                <%--<a href="javascript:void(0)" class="btn-yellow _goSubmit">保存</a>--%>
                                <input type="submit" class="btn-yellow" value="保存">
                            </shiro:hasPermission>
                            <a onclick="JavaScript:history.go(-1);" class="btn-gray-outline1 mgl-10 w-input60">返回</a>
                        </div>
                    </div>
                </form:form>
            </div>
            <!-- 此处为页面代码 end -->
        </div>
    </div>
</div>

<div class="loading-box fade in" id="loadingDiv" style="display: none"></div>
<!--遮罩层-->
<div id="backMask" style="display: none"></div>
<script src="${ctxStatic}/plat2016/public/js/jquery-validation/1.11.0/jquery.validate.min.js" type="text/javascript"></script>
<script type="text/javascript">

    $(function(){
        var itemType = $("#itemType").val();
        changeShow(itemType);
        $("#inputForm").validate({
            submitHandler: function (form) {
                $("#loadingDiv").show();
                var iType = $("#itemType").val();
                if (iType == '0' || iType == '1') {
                    $("#check > div[id!='checkType1']").remove();
                } else if (iType == '2') {
                    $("#check > div[id!='checkType2']").remove();
                } else if (iType == '3') {
                    $("#check > div[id!='checkType3']").remove();
                } else if (iType == '4') {
                    $("#check > div[id!='checkType4']").remove();
                } else if (iType == '5') {
                    $("#check > div[id!='checkType5']").remove();
                }
                form.submit();
            },
            errorContainer: "#messageBox",
            errorPlacement: function (error, element) {
                $("#messageBox").text("输入有误，请先更正。");
                if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                    error.appendTo(element.parent().parent());
                } else {
                    error.insertAfter(element);
                }
            }
        });
    });
    function changeShow(val) {
        $("#check > div").hide();
        if (val == '0' || val == '1') {
            $("#checkType1").show();
        } else if (val == '2') {
            $("#checkType2").show();
        } else if (val == '3') {
            $("#checkType3").show();
        } else if (val == '4') {
            $("#checkType4").show();
        } else if (val == '5') {
            $("#checkType5").show();
        }
    }
</script>
</body>
</html>